﻿@using CML.Intercamber.Business
@using CML.Intercamber.Web
@using CML.Intercamber.Web.Helpers
<!DOCTYPE html>
<html lang="fr">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta charset="utf-8" />
        <title>@Resources.Intercamber.ApplicationTitle - @ViewBag.PageTitle</title>
        <link href="/favicon.ico?@ViewBag.VersionNumber" rel="shortcut icon" type="image/x-icon" />
        <meta name="viewport" content="width=device-width" />
        <link href="/Content/jquery-ui-1.9.2.custom.min.css?@ViewBag.VersionNumber" rel="stylesheet" />
        <link href="/Content/jquery.jqGrid/ui.jqgrid.css?@ViewBag.VersionNumber" rel="stylesheet" />
        <link href="/Content/site.css?@ViewBag.VersionNumber" rel="stylesheet" />
        <link href="/Scripts/qtip/jquery.qtip.min.css?@ViewBag.VersionNumber" rel="stylesheet" />
        <link href="~/Scripts/Chosen/chosen.min.css" rel="stylesheet" />
        <script src="/Scripts/jquery-1.8.3.min.js?@ViewBag.VersionNumber"></script>
        <script src="/Scripts/jquery.cookie.js?@ViewBag.VersionNumber"></script>
        <script src="/Scripts/jquery-ui-1.9.2.custom.min.js?@ViewBag.VersionNumber"></script>
        <script src="/Scripts/jquery.jqGrid.js?@ViewBag.VersionNumber"></script>
        <script src="/Scripts/i18n/grid.locale-en.js?@ViewBag.VersionNumber"></script>
        <script src="/Scripts/jquery.signalR-1.1.3.js"></script>
        <script src="/Scripts/qtip/jquery.qtip.min.js?@ViewBag.VersionNumber"></script>
        <script src="~/Scripts/jquery.chosen.min.js"></script>
        <script src="/Scripts/Intercamber.js?@ViewBag.VersionNumber"></script>
        <script src="/signalr/hubs"></script>
        <script>
            var connectedHub = null;
            var hubReady = null;
            var pageCode = "@(NavigationHelper.CurrentPageRoute)";
            var myId = @(ViewBag.ConnectedUserInfo != null ? ViewBag.ConnectedUserInfo.IdUser : -1);
            var unreadMsgCount = @Html.Raw(ViewBag.MessagesCount ?? "{}");
        </script>
        <style>
            body{
                text-align: center;
                background-image: url('/Images/Background/Background.jpg');
                background-size: 100% auto;
                background-color: #003986;
                background-repeat: no-repeat;
            }
        </style>
        @RenderSection("PageHead", false)        
    </head>
    @{
        Users connectedUser = ViewBag.ConnectedUserInfo;
    }
    <body>
        <div class="warningMessage">@ViewBag.WarningMessage</div>
        <div id="centpourcent">
            <table width="100%" style="height: 100%" cellspacing="0" cellpadding="0" class="mainTable">
                <tr class="titleTable">
                    <td id="titleTd" class="titreApplication" style="position:relative;">
                        <div style="width:100%; height:150px; position:relative;" >
                            <img src="~/Images/TitreIntercambers.png" style="margin:20px 0 20px 290px; height:80px;"/>
                            <span class="languageSelector">
                                <a href="/Account/ChangeLanguage?id=fr">
                                    <img class="imgButton @(ViewBag.UiLanguage == "fr" ? "imgButtonSelected" : "")" src="~/Images/Flags/fr.png" title="@Resources.Intercamber.Languages_fr" /></a>
                                <a href="/Account/ChangeLanguage?id=es">
                                    <img class="imgButton @(ViewBag.UiLanguage == "es" ? "imgButtonSelected" : "")" src="~/Images/Flags/es.png" title="@Resources.Intercamber.Languages_es" /></a>
                                <a href="/Account/ChangeLanguage?id=en">
                                    <img class="imgButton @(ViewBag.UiLanguage == "en" ? "imgButtonSelected" : "")" src="~/Images/Flags/uk.png" title="@Resources.Intercamber.Languages_en" /></a>
                                <br />
                                <span id="onlineUsers" style="display: none"></span>
                                <span style="padding-top:5px; display:inline-block;">
                                    @if (Request.IsAuthenticated)
                                    {
                                        using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" }))
                                        {
                                            <text>
                                                <span class="disconnect">@Resources.Intercamber.Disconnect</span>
                                                <a href="javascript:document.getElementById('logoutForm').submit()">
                                                    <img title="@(Resources.Intercamber.Logout)" src="/Images/Disconnect.png" class="imgButton" style="margin-bottom:-1px;" />
                                                </a>
                                            </text>
                                        }
                                    }
                                </span>
                            </span>
                            <span class="menu">
                                <ul id="menu" style="border: 0;">
                                    @if (Request.IsAuthenticated)
                                    {
                                        <li><a href="~/Home/Index">@Resources.Intercamber.Home_PageName</a></li>
                                        <li><a href="~/Contact/Search">@Resources.Intercamber.SearchContacts_PageName</a></li>
                                        <li><a href="#" onclick='alert("@Html.Raw(Resources.Intercamber.WorkInProgress)");'>@Resources.Intercamber.Project_PageName</a></li>
                                        <li>
                                            <a href="#">@Resources.Intercamber.Toolbox_PageName</a>
                                            <ul class="appSubMenu">
                                                <li><a href="~/Talk/Translations" style="color: black;">@Resources.Intercamber.Translations_PageName</a></li>
                                            </ul>
                                        </li>
                                        <li><a href="~/Home/Contact">@Resources.Intercamber.Assistance_PageName</a></li>
                                        if (connectedUser != null && (connectedUser.IsAdmin || connectedUser.IsTeacher))
                                        {
                                            <text>
                                                <li>
                                                    <a href="#">@Resources.Intercamber.Admin_PageName &nbsp;</a>
                                                    <ul class="appSubMenu">
                                                        <li><a href="~/Admin/StudentInvite" style="color: black;">@Resources.Intercamber.StudentInvite_PageName</a></li>
                                                        <li><a href="~/Admin/Users" style="color: black;">@Resources.Intercamber.UserAdmin_PageName</a></li>
                                                        <li><a href="~/Admin/News" style="color: black;">@Resources.Intercamber.News_PageName</a></li>
                                                        @if(connectedUser.IsAdmin)
                                                        {
                                                            <li><a href="~/Admin/Moderation" style="color: black;">@Resources.Intercamber.Moderate_PageName</a></li>
                                                            <li><a href="~/Admin/Establishment" style="color: black;">@Resources.Intercamber.EstablishmentAdmin_PageName</a></li>
                                                            <li><a href="~/Admin/Statistics" style="color: black;">@Resources.Intercamber.Reporting_PageName</a></li>
                                                            <li><a href="~/Admin/Texts" style="color: black;">@Resources.Intercamber.TextManagement_PageName</a></li>
                                                        }
                                                    </ul>
                                                </li>
                                            </text>
                                        }
                                    }
                                    @if (!Request.IsAuthenticated)
                                    {
                                        <text>
                                            <li><a href="~/Account/Login">@Resources.Intercamber.Login_ConnectTitle</a></li>
                                        </text>
                                    }
                                </ul>
                            </span>
                        </div>
                    </td>
                </tr>
                <tr class="contentTable">
                    <td id="pageContent">
                        @*<div align="left" class="titleDiv" id="pageTitle">
                                @ViewBag.PageTitle
                            </div>*@
                        <table class="calcHeight" style="width: 100%;" cellspacing="0" cellpadding="0">
                            <tr>
                                <td class="infoBar" @if (ViewBag.HideLeftBar == true)
                                                    {<text>style='display:none;'</text>}>
                                    @RenderSection("PageLeftBar", false)
                                </td>
                                <td class="pageContent paddedContent">
                                    @RenderSection("PageContent")
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>

            <div id="footerLeft" class="footerLeft">
                ©@Resources.Intercamber.ApplicationTitle @("v" + ViewBag.VersionNumber) 2014
            </div>
        </div>
        @if (Request.IsAuthenticated)
        {
        
            <div class="contactsTitle ui-widget-header" onmouseover="$(this).removeClass('ui-widget-header')" onmouseout="$(this).addClass('ui-widget-header')" onclick="ToggleDisplayContacts()">
                Contacts
                <img style="padding-left: 10px" id="contactToggle" src="/Images/Minimize.png" />
            </div>
            <div class="contactsContent">
                @foreach (var cd in ViewBag.MyContacts)
                {
                    <text>
                        <span class="contactItem">
                            <img id="contactCnx@(cd.IdUser)" src="@(ChatHub.IsUserConnected(cd.IdUser) ? "/Images/Online.png" : "/Images/Offline.png")" />
                            &nbsp;<a href="~/Talk/Discussion/@(cd.IdUser)">@(cd.FirstName)&nbsp;@(cd.LastName)&nbsp;<span id="UM@(cd.IdUser)" class="unreadMsg ui-state-highlight ui-corner-all" style="@(cd.NumUnreadMessages == 0 ? "display:none" : "")">@cd.NumUnreadMessages</span></a><br />
                        </span>
                    </text>
                }
            </div>
        }

    </body>
</html>
